/**
 * 组件的基础特殊配置
 * @param title 显示的title
 * @param componentName 对应要渲染的组件名称，目前支持select,textarea,inputNumber,input,switch,jsoneditor
 * @param options 数据组件需要显示的数据
 * @param precondition 显示的前提条件  前置是name 对应的值是 value 对应的值
 */
export const extraConfig = {
  // 文本框
  textItem: {
    content: {
      title: '文本',
      componentName: 'textarea'
    },
    fixWidth: {
      title: '定宽',
      componentName: 'switch'
    },
    fixHeight: {
      title: '定高',
      componentName: 'switch'
    }
  },

  // 输入框
  inputItem: {
    type: {
      componentName: 'select',
      title: '类型',
      options: [
        {
          label: 'text',
          value: 'text'
        },
        {
          label: 'password',
          value: 'password'
        },
        {
          label: 'textarea',
          value: 'textarea'
        },
        {
          label: 'number',
          value: 'number'
        }
      ]
    },
    rows: {
      title: '行数',
      componentName: 'inputNumber',
      precondition: {
        name: 'type',
        value: 'textarea'
      }
    },
    maxlength: {
      title: '最大长度',
      componentName: 'inputNumber'
    },
    height: {
      title: '组件高度',
      componentName: 'inputNumberPx'
    }
  },

  // 开关
  switchItem: {
    trueValue: {
      componentName: 'input',
      title: '选中值'
    },
    falseValue: {
      componentName: 'input',
      title: '未选中值'
    }
  },

  // 下拉框
  selectItem: {
    options: {
      componentName: 'jsoneditor',
      title: '静态数据'
    },
    multiple: {
      componentName: 'switch',
      title: '是否多选'
    }
  },

  // 日期
  datepickerItem: {
    type: {
      componentName: 'select',
      title: '类型',
      options: [
        {
          label: 'date',
          value: 'date'
        },
        {
          label: 'daterange',
          value: 'daterange'
        },
        {
          label: 'datetime',
          value: 'datetime'
        },
        {
          label: 'year',
          value: 'year'
        },
        {
          label: 'month',
          value: 'month'
        }
      ]
    },
    format: {
      componentName: 'select',
      title: '格式',
      options: [
        {
          value: 'yyyy-MM-dd',
          label: 'yyyy-MM-dd'
        },
        {
          value: 'yyyy-MM-dd HH:mm:ss',
          label: 'yyyy-MM-dd HH:mm:ss'
        },
        {
          value: 'yyyy-MM',
          label: 'yyyy-MM'
        },
        {
          value: 'yyyy',
          label: 'yyyy'
        },
        {
          value: 'MM',
          label: 'MM'
        }
      ]
    }
  },

  // 按钮
  buttonItem: {
    ghost: {
      componentName: 'switch',
      title: '背景透明'
    },
    long: {
      componentName: 'switch',
      title: '长显示'
    },
    customIcon: {
      componentName: 'input',
      title: '自定义图标'
    },
    title: {
      componentName: 'input',
      title: '文本'
    },
    to: {
      componentName: 'input',
      title: '跳转地址'
    },
    target: {
      componentName: 'select',
      title: '跳转类型',
      options: [
        {
          label: '_self',
          value: '_self'
        },
        {
          label: 'target',
          value: 'target'
        }
      ]
    },
    type: {
      componentName: 'select',
      title: '类型',
      options: [
        {
          label: 'default',
          value: 'default'
        },
        {
          label: 'primary',
          value: 'primary'
        },
        {
          label: 'dashed',
          value: 'dashed'
        },
        {
          label: 'text',
          value: 'text'
        },
        {
          label: 'info',
          value: 'info'
        },
        {
          label: 'success',
          value: 'success'
        },
        {
          label: 'warning',
          value: 'warning'
        },
        {
          label: 'error',
          value: 'error'
        }
      ]
    }
  },

  // 复选框
  checkboxItem: {
    label: {
      componentName: 'input',
      title: '文本'
    }
  },

  // 复选框组合
  checkboxgroupItem: {
    options: {
      componentName: 'jsoneditor',
      title: '静态数据'
    },
    marginRight: {
      componentName: 'inputNumber',
      title: '右边距'
    },
    border: {
      componentName: 'switch',
      title: '边框'
    }
  },

  // 单选框
  radioItem: {
    label: {
      componentName: 'input',
      title: '文本'
    }
  },

  // 单选框组合
  radiogroupItem: {
    options: {
      componentName: 'jsoneditor',
      title: '静态数据'
    },
    marginRight: {
      componentName: 'inputNumber',
      title: '右边距'
    },
    border: {
      componentName: 'switch',
      title: '边框'
    }
  },

  // 评分
  rateItem: {
    count: {
      componentName: 'inputNumber',
      title: '总数'
    },
    allowHalf: {
      componentName: 'switch',
      title: '显示半数'
    },
    showText: {
      componentName: 'switch',
      title: '显示文本'
    },
    clearable: {
      componentName: 'switch',
      title: '是否可清除'
    },
    character: {
      componentName: 'input',
      title: '自定义字符'
    },
    customicon: {
      componentName: 'input',
      title: '自定义图标'
    }
  },

  // 表格
  tableItem: {
    columns: {
      componentName: 'jsoneditor',
      title: '列配置'
    },
    data: {
      componentName: 'jsoneditor',
      title: '静态数据源'
    },
    stripe: {
      componentName: 'switch',
      title: '斑马纹'
    },
    border: {
      componentName: 'switch',
      title: '纵向边框'
    },
    highlightRow: {
      componentName: 'switch',
      title: '单选高亮'
    }
  },

  // 段落
  sectionItem: {
    showTag: {
      componentName: 'switch',
      title: '显示标签'
    },
    tagType: {
      componentName: 'select',
      title: '标签类型',
      options: [
        {
          label: 'primary',
          value: 'primary'
        },
        {
          label: 'success',
          value: 'success'
        },
        {
          label: 'warning',
          value: 'warning'
        },
        {
          label: 'error',
          value: 'error'
        },
        {
          label: 'dashed',
          value: 'dashed'
        },
        {
          label: 'text',
          value: 'text'
        },
        {
          label: 'info',
          value: 'info'
        },
        {
          label: 'info',
          value: 'info'
        }
      ],
      precondition: {
        name: 'showTag',
        value: true
      }
    },
    tagName: {
      componentName: 'input',
      title: '标签文本',
      precondition: {
        name: 'showTag',
        value: true
      }
    },
    tagSource: {
      componentName: 'sourceSelect',
      title: '标签数据源',
      precondition: {
        name: 'showTag',
        value: true
      }
    },
    showTitle: {
      componentName: 'switch',
      title: '显示标题'
    },
    title: {
      componentName: 'input',
      title: '标题文本',
      precondition: {
        name: 'showTitle',
        value: true
      }
    },
    titleSource: {
      componentName: 'sourceSelect',
      title: '标题数据源',
      precondition: {
        name: 'showTag',
        value: true
      }
    },
    content: {
      componentName: 'textarea',
      title: '段落内容'
    },
    contentSource: {
      componentName: 'sourceSelect',
      title: '段落数据源'
    },
    mode: {
      componentName: 'select',
      title: '显示模式',
      options: [
        {
          value: 'normal',
          label: '普通模式'
        },
        {
          value: 'switch',
          label: '切题模式'
        }
      ]
    },
    switchSource: {
      componentName: 'sourceSelect',
      title: '切题数据源',
      precondition: {
        name: 'mode',
        value: 'switch'
      }
    },
    switchData: {
      componentName: 'jsoneditor',
      title: '静态数据',
      precondition: {
        name: 'mode',
        value: 'switch'
      }
    },
    prevText: {
      componentName: 'input',
      title: 'prev文本',
      precondition: {
        name: 'mode',
        value: 'switch'
      }
    },
    nextText: {
      componentName: 'input',
      title: 'next文本',
      precondition: {
        name: 'mode',
        value: 'switch'
      }
    },
    checkedId: {
      componentName: 'idSelect',
      title: '校验组件',
      precondition: {
        name: 'mode',
        value: 'switch'
      }
    }
  },
  // 划线
  delimitItem: {
    title: {
      componentName: 'input',
      title: '标题文本'
    },
    content: {
      componentName: 'textarea',
      title: '段落内容'
    },
    contentSource: {
      componentName: 'sourceSelect',
      title: '段落数据源'
    },
    // labelOptions: {
    //   componentName: 'jsoneditor',
    //   title: '表格表头'
    // },
    selectSource: {
      componentName: 'sourceSelect',
      title: '选择数据源'
    }
  }
}
